package com.rd.student.dashuju.zhengchengxiang.test;

import java.util.HashSet;

public class QQNumber {
    public static void main(String[] args) {
        String[] strs = {"12345", "67891", "123478099", "9876543", "67891", "12347809933", "12809933", "12347809933111", "9876543", "12809933"};

        HashSet<String> qqNumbersSet = new HashSet<>();

        // 将qq号码存放在集合中，并自动去重
        for (String str : strs) {
            if (isValidQQ(str)) {
                qqNumbersSet.add(str);
            }
        }

        System.out.println("去重后的qq号码集合：");
        System.out.println(qqNumbersSet);
    }

    // 判断是否为有效的qq号码
    private static boolean isValidQQ(String str) {
        return str.length() >= 6 && str.length() <= 9;
    }
}

